import request from '@/utils/request';
import { AxiosResponse } from 'axios';

// 定义通用API响应接口
export interface ApiResponse<T> {
  code: number;
  msg: string;
  data: T;
}

// 定义首页数据的接口
export interface OrderItem {
  orderId: string;
  productCode: string;
  productName: string;
  progress: number;
}

export interface EvaluationItem {
  id?: string;
  creator_name: string;
  create_time: string;
  score: number;
  evaluate_content: string;
  reversion_content?: string;
}

export interface EvaluateData {
  Rows: EvaluationItem[];
  Total: number;
}

export function getListData(params?: any): Promise<ApiResponse<EvaluateData>> {
  return request.post<ApiResponse<EvaluateData>>('/evaluation/page', params)
    .then((response: AxiosResponse<ApiResponse<EvaluateData>>) => {
      return response.data;
    });
}

export function submitData(params?: any): Promise<ApiResponse<EvaluateData>> {
  return request.post<ApiResponse<EvaluateData>>('/evaluation/add', params)
    .then((response: AxiosResponse<ApiResponse<EvaluateData>>) => {
      return response.data;
    });
} 